package org.xmonkey.util;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.statushandlers.StatusManager;
import org.xmonkey.messages.UserMessage;

/**
 * This class is responible for logging items using an Eclipse StatusManager and IStatus messages
 * @author Jappo
 *
 */
public final class Log {
	
	public static void printError(String error, Throwable t){
		IStatus errorMessage = new UserMessage(IStatus.ERROR,error, t);
		StatusManager.getManager().handle(errorMessage, StatusManager.LOG|StatusManager.SHOW);
	}
	
	public static void printWarning(String warning, Throwable t){
		IStatus warningMessage = new UserMessage(IStatus.WARNING,warning, t);
		StatusManager.getManager().handle(warningMessage, StatusManager.LOG);
	}
	
	public static void printInfo(String info, Throwable t){
		IStatus infoMessage = new UserMessage(IStatus.INFO, info, t);
		StatusManager.getManager().handle(infoMessage, StatusManager.LOG);
	}

}
